package com.ssdp.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author syo 2319615164@qq.com
 * @description Redisson客户端配置类
 * @date 2024/3/14
 * @Copyright syo
 */
@Configuration
public class RedissonConfig {

    @Value("${ssdp.host}")
    public String host;

    @Value("${ssdp.port.redis}")
    public String port;

    /**
     * Redisson客户端注入
     * @return Redisson客户端
     */
    @Bean
    public RedissonClient redissonClient() {
        Config config = new Config();
        config.useSingleServer().setAddress("redis://" + host + ":" + port).setPassword("1234");
        return Redisson.create(config);
    }
}
